/**
 * Copyright 2014 the original author or authors. All rights reserved.
 */
package com.visionet.security.support;

import com.visionet.security.domain.dto.UserDTO;
import org.apache.shiro.SecurityUtils;

/**
 *  获取登录用户信息
 *
 * @author suxiaojing
 * @date 
 * @since 0.0.1
 */
public class UserContext {
	
	public static UserDTO getUser(){
		return (UserDTO) SecurityUtils.getSubject().getPrincipal();
	}
	
	public static String getUserId(){
		return ((UserDTO) SecurityUtils.getSubject().getPrincipal()).getId();
	}
	
	public static String getUserName(){
		return ((UserDTO) SecurityUtils.getSubject().getPrincipal()).getName();
	}
	
	public static String getLoginName(){
		return ((UserDTO) SecurityUtils.getSubject().getPrincipal()).getLoginName();
	}
}
